home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / tlx3sort.arc / WRITEFON.C < prev   
C/C++ Source or Header  |  1988-07-13  |  2KB  |  81 lines

  1. /**
  2.  *
  3.  *  Module:       writefon.c
  4.  *  Version:      2.0
  5.  *  Description:  routines to write telix 3.0 fon file
  6.  *  Author:       Paul Roub
  7.  *
  8.  *  Revision History:
  9.  *     7-13-88 : created
  10.  *
  11.  *      This program and its sources are Copyright (C) 1988 by Paul Roub
  12.  *      and may not be sold for profit without the express written
  13.  *      consent of the author.  Redistribute them (in their entirety) as
  14.  *      you wish,  provided no fee is charged and all materials are
  15.  *      present and unmodified.
  16.  *
  17. **/
  18.  
  19. /*<f>*/
  20. #include  <stdio.h>
  21. #include  "tlx30.h"
  22. #include  "tlxsort.h"
  23.  
  24.  
  25. static  void      WriteFonHeader ( fon_header *th, FILE *fil );
  26.  
  27.  
  28. /*<f>*/
  29. /**
  30.  *
  31.  *  Function:     void WriteFonFile()
  32.  *  Description:  write fon file to disk
  33.  *  Returns:      nothing
  34.  *
  35. **/
  36. void WriteFonFile(name, th, te)
  37. char      *name;
  38. fon_header *th;
  39. fon_entry  *te;
  40. {
  41.   FILE      *fil;
  42.   int       result;
  43.  
  44.   fil = ffopen(name, "wb");
  45.  
  46.   WriteFonHeader(th, fil);
  47.  
  48.   result = fwrite(te, sizeof(fon_entry), (size_t)th->num_entries, fil);
  49.  
  50.   if (result != th->num_entries)
  51.     quitf("error writing fon file %s", name);
  52.  
  53.   fclose(fil);
  54.  
  55.   return;
  56. }
  57.  
  58.  
  59. /*<f>*/
  60. /**
  61.  *
  62.  *  Function:     static void WriteFonHeader()
  63.  *  Description:  write telix 3.0 fon header
  64.  *  Returns:      nothing
  65.  *
  66. **/
  67. static void WriteFonHeader(th, fil)
  68. fon_header *th;
  69. FILE      *fil;
  70. {
  71.   int       result;
  72.  
  73.   result = fwrite(th, sizeof(fon_header), 1, fil);
  74.  
  75.   if (result != 1)
  76.     quitf("error writing fon file header");
  77.  
  78.   return;
  79. }
  80.  
  81.